<?php
// Main index 
class PaymentAction extends CommonHomeAction {
    public function index() {
        $company_id = 1;
        
        $model = D("Payment");
        $voList = $model->where(array("company_id" => $company_id))->select();
        if (false !== $list) {
            $this->assign("list", $voList);
        }
        $this->display();
    }
    
    public function paydetail() {
        $company_id = 1;
        
        $pmodel = D("Payment");
        $model = D("Paydetail");
        $id = $_REQUEST [$pmodel->getPk()];
        $vo = $pmodel->where(array("id" => $id))->find();
        if (false !== $vo) {
            $this->assign("vo", $vo);
        }
        
        $voList = $model->where(array("company_id" => $company_id, "pay_id" => $id))->select();
        if (false !== $voList) {
            $this->assign("list", $voList);
            $total = 0;
            foreach ($voList as $row) {
                $total += $row["shop_price"];
            }
            $this->assign("total", $total);
        }
        
        $this->display();
    }
}
?>
